<template>
	

	<view>
		<block v-for="(item,index) in dataList" :key="index">
			<p style="margin-top: 20rpx; margin-left: 10rpx;"><b>{{item.communityCategoryName}}</b></p>
			<tui-grid :bottom-line="false" unlined>
				<block v-for="(community,index) in item.communityList" :key="index">
					<tui-grid-item :cell="4" @click="communityClickHandler(item.id,community.id)" :border="false" :bottom-line="false" >
						<image :src="community.communityImg" mode="widthFix" style="width: 100%;border-radius:25rpx;"/>
						<text class="tui-grid-label" style="text-align: center; display: block; font-size: 20rpx;color: grey;">{{community.name}}</text>
					</tui-grid-item>
				</block>
			</tui-grid>	
		</block>
		
	</view>
</template>

<script>
	import communityApi from '@/request/api/communityApi.js'
	export default {
		data() {
			return {
				dataList:[],
			}
		},
		mounted() {
			this.getDataList()
		},
		methods: {
			//获取数据列表
			getDataList(){
				communityApi.getCommunityIndexData().then(response =>{

					this.dataList = response.data;
				})
			},
			communityClickHandler(communityCategoryId,communityId){
				uni.navigateTo({
					url:`./communityInfo?communityCategoryId=${communityCategoryId}&communityId=${communityId}`
				})
			}
		}
	}
</script>

<style>

</style>
